package com.jiuli.kafkaleaning;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

// https://blog.csdn.net/qq_43410878/article/details/123716629
public class JavaStreamLeaning {

    public static void main(String[] args) {
        List<String> list = Arrays.asList("m,k,l,a", "1,3,5,7");
        List<String> listNew = list.stream().flatMap(s -> {
            // 将每个元素转换成一个stream
            String[] split = s.split(",");
            return Arrays.stream(split);
        }).toList();

        System.out.println("处理前的集合：" + list);
        System.out.println("处理后的集合：" + listNew);
        List<String> list1 = Arrays.asList("m", "k", "l", "a");
        System.out.println(list1);
    }
}
